/*************************************************************************
	> File Name: stiching_picture.cpp
	> Author: 
	> Mail: 
	> Created Time: 2021年05月17日 星期一 17时26分21秒
 ************************************************************************/

/*找两张图片（如苹果和梨），第一张图片的左边与第二张图的右边合成一张图*/

#include <opencv2/opencv.hpp>
#include <iostream>
#include <cstdio>

using namespace cv;
using namespace std;


int main() {
    Mat appleImage = imread("../data/apple.jpg");
    Mat pearImage = imread("../data/pear.jpg");

    Mat srcImage;
    resize(appleImage, appleImage, Size(pearImage.cols, pearImage.rows));

    int height = pearImage.rows;
    int width = pearImage.cols;

    Mat destImage;
    destImage.create(height, width * 2, pearImage.type());

    Mat img1 = destImage(Rect(0, 0, width, height));
    pearImage.copyTo(img1);

    Mat img2 = destImage(Rect(width, 0, width, height));
    appleImage.copyTo(img2);

    imwrite("destImage.jpg", destImage);

    imshow("Combined Picture", destImage);

    waitKey(0);

    return 0;
}



